package fuck;

import java.lang.reflect.Field;

public class Test2 {
    public static void main(String[] args) throws Exception {
        //  method1();
        Class clazz = Class.forName("fuck.Student");
        Field field = clazz.getDeclaredField("money");
        field.setAccessible(true);
        Student student= (Student) clazz.newInstance();
        Object o = field.get(student);
        System.out.println(o);

    }

    private static void method1() throws ClassNotFoundException, NoSuchFieldException, InstantiationException, IllegalAccessException {
        Class clazz = Class.forName("fuck.Student");
        Field field = clazz.getField("name");
        Student student = (Student) clazz.newInstance();
        field.set(student, "阿童木");
        System.out.println(field);
    }
}
